{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 381,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import requests\n",
    "import grequests\n",
    "from pattern import web\n",
    "import pandas as pd\n",
    "import csv\n",
    "import time\n",
    "import sys\n",
    "import re\n",
    "from ast import literal_eval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# define function to return dom\n",
    "f = lambda url: web.Element(requests.get(url).text)\n",
    "g = lambda response: web.Element(response.text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###Grab teams of each season from 92-93 to 15-16."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['http://www.11v11.com/league-tables/premier-league/01-september-1992/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-1993/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-1994/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-1995/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-1996/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-1997/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-1998/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-1999/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2000/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2001/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2002/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2003/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2004/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2005/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2006/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2007/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2008/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2009/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2010/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2011/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2012/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2013/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2014/',\n",
       " 'http://www.11v11.com/league-tables/premier-league/01-september-2015/']"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "url_by_season = \\\n",
    "['http://www.11v11.com/league-tables/premier-league/01-september-'+str(start_year)+'/' for \\\n",
    "                                                            start_year in range(1992, 2016)]\n",
    "url_by_season"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# for collecting all teams appeared in the 24 seasons\n",
    "teams_pool = []\n",
    "teams_by_season = {}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time point: 01-september-1992\n",
      "----------------------\n",
      "time point: 01-september-1993\n",
      "----------------------\n",
      "time point: 01-september-1994\n",
      "----------------------\n",
      "time point: 01-september-1995\n",
      "----------------------\n",
      "time point: 01-september-1996\n",
      "----------------------\n",
      "time point: 01-september-1997\n",
      "----------------------\n",
      "time point: 01-september-1998\n",
      "----------------------\n",
      "time point: 01-september-1999\n",
      "----------------------\n",
      "time point: 01-september-2000\n",
      "----------------------\n",
      "time point: 01-september-2001\n",
      "----------------------\n",
      "time point: 01-september-2002\n",
      "----------------------\n",
      "time point: 01-september-2003\n",
      "----------------------\n",
      "time point: 01-september-2004\n",
      "----------------------\n",
      "time point: 01-september-2005\n",
      "----------------------\n",
      "time point: 01-september-2006\n",
      "----------------------\n",
      "time point: 01-september-2007\n",
      "----------------------\n",
      "time point: 01-september-2008\n",
      "----------------------\n",
      "time point: 01-september-2009\n",
      "----------------------\n",
      "time point: 01-september-2010\n",
      "----------------------\n",
      "time point: 01-september-2011\n",
      "----------------------\n",
      "time point: 01-september-2012\n",
      "----------------------\n",
      "time point: 01-september-2013\n",
      "----------------------\n",
      "time point: 01-september-2014\n",
      "----------------------\n",
      "time point: 01-september-2015\n",
      "----------------------\n"
     ]
    }
   ],
   "source": [
    "# by each season(24 in total), 0-23\n",
    "for season in range(24):\n",
    "    print 'time point: '+url_by_season[season].split('/')[-2] + '\\n----------------------'\n",
    "    dom = f(url_by_season[season])\n",
    "    num = len(dom.by_tag('tbody')[0].by_tag('tr'))\n",
    "    teams = [str(dom.by_tag('tbody')[0].by_tag('tr')[ranking].by_tag('td')[1].content.split('/')[2]) \\\n",
    "             for ranking in range(num)]\n",
    "    # add teams to teams_pool\n",
    "    for t in teams:\n",
    "        if t not in teams_pool:\n",
    "            teams_pool.append(t)\n",
    "    # teams for each season, start_year\n",
    "    teams_by_season[range(1992, 2016)[season]] = teams"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 380,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['norwich-city', 'blackburn-rovers', 'queens-park-rangers', 'everton', 'leeds-united', 'arsenal', 'coventry-city', 'ipswich-town', 'manchester-city', 'middlesbrough', 'oldham-athletic', 'manchester-united', 'sheffield-wednesday', 'aston-villa', 'chelsea', 'liverpool', 'southampton', 'crystal-palace', 'sheffield-united', 'nottingham-forest', 'tottenham-hotspur', 'wimbledon', 'newcastle-united', 'west-ham-united', 'swindon-town', 'leicester-city', 'bolton-wanderers', 'sunderland', 'derby-county', 'barnsley', 'charlton-athletic', 'watford', 'bradford-city', 'fulham', 'birmingham-city', 'west-bromwich-albion', 'portsmouth', 'wolverhampton-wanderers', 'wigan-athletic', 'reading', 'hull-city', 'stoke-city', 'burnley', 'blackpool', 'swansea-city', 'cardiff-city', 'afc-bournemouth']\n"
     ]
    }
   ],
   "source": [
    "print teams_pool"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "47 teams have played in the Premier League for the past 24 seasons, see the above list\n"
     ]
    }
   ],
   "source": [
    "print str(len(teams_pool))+' teams have played in the Premier League for the past 24 seasons, see the above list'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['norwich-city',\n",
       " 'blackburn-rovers',\n",
       " 'queens-park-rangers',\n",
       " 'everton',\n",
       " 'leeds-united',\n",
       " 'arsenal',\n",
       " 'coventry-city',\n",
       " 'ipswich-town',\n",
       " 'manchester-city',\n",
       " 'middlesbrough',\n",
       " 'oldham-athletic',\n",
       " 'manchester-united',\n",
       " 'sheffield-wednesday',\n",
       " 'aston-villa',\n",
       " 'chelsea',\n",
       " 'liverpool',\n",
       " 'southampton',\n",
       " 'crystal-palace',\n",
       " 'sheffield-united',\n",
       " 'nottingham-forest',\n",
       " 'tottenham-hotspur',\n",
       " 'wimbledon']"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# key:start_year, e.g. 1992\n",
    "teams_by_season[1992]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "start_year: [1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015]\n"
     ]
    }
   ],
   "source": [
    "print 'start_year:', teams_by_season.keys()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###Grab match data by season"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "season 2015-2016\n",
      "\n",
      "requests the urls of all teams...\n",
      "done...\n",
      "-------------------------------------\n",
      "team NO.1\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.2\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.3\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.4\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.5\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.6\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.7\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.8\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.9\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.10\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.11\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.12\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.13\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.14\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.15\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.16\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.17\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.18\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.19\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n",
      "team NO.20\n",
      "requests the urls of all matches...\n",
      "done...\n",
      "-------------------------------------\n",
      "parsing match data...\n",
      "done\n",
      "-------------------------------------\n"
     ]
    }
   ],
   "source": [
    "# in case storing replicate matches\n",
    "match_pool = []\n",
    "\n",
    "month = {'Jan':'01', 'Feb':'02', 'Mar':'03', 'Apr':'04', 'May':'05',\\\n",
    "         'Jun':'06', 'Jul':'07', 'Aug':'08', 'Sep':'09', 'Oct':'10', 'Nov':'11', 'Dec':'12'}\n",
    "\n",
    "# in this season\n",
    "for start_year in [2015]:\n",
    "    # make csv file\n",
    "    season = str(start_year)+'-'+str(start_year+1)\n",
    "    print 'season '+season+'\\n'\n",
    "    path = 'data/'+season+'.csv'\n",
    "    with open(path, 'a') as fp:\n",
    "        a = csv.writer(fp, delimiter=',')\n",
    "        data = [['Date','Home','Away','FTHG','FTAG']]\n",
    "        #data = [[Date,Home,Away,FTHG,FTAG]]\n",
    "        a.writerows(data)\n",
    "\n",
    "\n",
    "    # requestes the urls of all teams\n",
    "    print 'requests the urls of all teams...'\n",
    "    urls_by_team = ['http://www.11v11.com/teams/'+team+'/tab/matches/season/'+str(start_year+1)+'/comp/1' \\\n",
    "                   for team in teams_by_season[start_year]]\n",
    "    rs = (grequests.get(u) for u in urls_by_team)\n",
    "    responses_by_team = grequests.map(rs) #a list of all responses\n",
    "    print 'done...\\n-------------------------------------'\n",
    "\n",
    "    for k,response_team in enumerate(responses_by_team):\n",
    "        dom = g(response_team)\n",
    "\n",
    "        # requests all matches by this team\n",
    "        print 'team NO.'+str(k+1)+'\\n'+'requests the urls of all matches...'\n",
    "        urls_by_match = ['http://www.11v11.com'+str(match.by_tag('td')[1].content).split('\"')[1] \\\n",
    "                         for match in dom.by_tag('tbody')[0].by_tag('tr')]\n",
    "        rs1 = (grequests.get(u) for u in urls_by_match)\n",
    "        responses_by_match = grequests.map(rs1) #a list of all responses\\\n",
    "        print 'done...\\n-------------------------------------'\n",
    "\n",
    "        print 'parsing match data...'\n",
    "        for i,game in enumerate(dom.by_tag('tbody')[0].by_tag('tr')):\n",
    "            # open this url we can see goal times\n",
    "            url = str(game.by_tag('td')[1].content).split('\"')[1]\n",
    "            match_index = url.split('-')[-1][:-1]\n",
    "            # coz we collect by teams, same match between two teams is repeated twice\n",
    "            if match_index in match_pool:\n",
    "                continue\n",
    "            else:\n",
    "                match_pool.append(match_index)\n",
    "            # match brief statistics are easy to grab\n",
    "            _Date = str(game.by_tag('td')[0].content)\n",
    "            Date = _Date.split(' ')[0]+'/'+month[_Date.split(' ')[1]]+'/'+_Date.split(' ')[2]\n",
    "            #print Date\n",
    "            Home,Away = str(game.by_tag('td')[1].by_tag('a')[0].content).split(' v ')\n",
    "            #print Home+' vs '+Away\n",
    "            try:\n",
    "                FTHG,FTAG = (int(g) for g in str(game.by_tag('td')[3].content).split('-'))\n",
    "                #print '%d:%d' %(FTHG,FTAG)\n",
    "            except:\n",
    "                FTHG,FTAG = '',''\n",
    "            # store goal times (minute, 0 or 1, scorer) in this list\n",
    "            goal_times = []\n",
    "            # if match is 0-0, don't open the match url\n",
    "            if (FTHG,FTAG) == (0,0):#no goal\n",
    "                pass\n",
    "            elif (FTHG,FTAG) == ('',''):#not kickoff\n",
    "                pass\n",
    "            else:\n",
    "                # open a single match\n",
    "                dom1 = g(responses_by_match[i])\n",
    "                # home goals\n",
    "                for goal in dom1.by_tag('div.goals')[0].by_tag('div.home')[0].by_tag('tr'):\n",
    "                    scorer = str(goal.by_tag('td')[0].content)\n",
    "                    goal_time = int(goal.by_tag('td.time')[0].content)\n",
    "                    goal_times.append((goal_time,0,scorer))#0 for home goals\n",
    "                # away goals\n",
    "                for goal in dom1.by_tag('div.goals')[0].by_tag('div.away')[0].by_tag('tr'):\n",
    "                    scorer = str(goal.by_tag('td')[0].content)\n",
    "                    goal_time = int(goal.by_tag('td.time')[0].content)\n",
    "                    goal_times.append((goal_time,1,scorer))#1 for away goals\n",
    "                #sort by scoring minute\n",
    "                goal_times.sort(key=lambda x: x[0])\n",
    "                #print goal_times\n",
    "\n",
    "            with open(path, 'a') as fp:\n",
    "                a = csv.writer(fp, delimiter=',')\n",
    "                #data = [['Date','Home','Away','FTHG','FTAG']]\n",
    "                data = [ [Date,Home,Away,FTHG,FTAG]+goal_times ]\n",
    "                a.writerows(data)\n",
    "        print 'done\\n-------------------------------------'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "###Read csv files into pd.DataFrame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 474,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "season = '2009-2010'\n",
    "path = 'data/'+season+'.csv'\n",
    "with open(path, 'r') as fl:\n",
    "    content = fl.readlines()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 475,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "goals = []\n",
    "for i,match in enumerate(content):\n",
    "    if i == 0:\n",
    "        continue\n",
    "    try:\n",
    "        goals.append(int(match.split(',')[3]) + int(match.split(',')[4]))\n",
    "    except:\n",
    "        goals.append(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 476,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "max goals in a match:  10\n",
      "let's just set 12 goal(columns), any match is not likely to score over 12 goals\n"
     ]
    }
   ],
   "source": [
    "print 'max goals in a match: ', max(goals)\n",
    "print \"let's just set 12 goal(columns), any match is not likely to score over 12 goals\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 477,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total matches in the current season:  380\n"
     ]
    }
   ],
   "source": [
    "matches = len(content)-1\n",
    "print 'total matches in the current season: ', matches"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 478,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# for goal times, (6, 0, Olivier Giroud) represents Giroud scored a goal at the 6th minute of the match\n",
    "# 0 represents the goal scored by home team, 1 represents the goal scored by away team\n",
    "df = pd.DataFrame({'Date': ['']*matches, \\\n",
    "                   'Home': ['']*matches, \\\n",
    "                   'Away': ['']*matches, \\\n",
    "                   'FTHG': [0]*matches, \\\n",
    "                   'FTAG': [0]*matches, \\\n",
    "                   '1 goal': ['']*matches, '2 goal': ['']*matches, '3 goal': ['']*matches, \\\n",
    "                   '4 goal': ['']*matches, '5 goal': ['']*matches, '6 goal': ['']*matches, \\\n",
    "                   '7 goal': ['']*matches, \\\n",
    "                   '8 goal': ['']*matches, \\\n",
    "                   '9 goal': ['']*matches, \\\n",
    "                   '10 goal': ['']*matches, \\\n",
    "                   '11 goal': ['']*matches, \\\n",
    "                   '12 goal': ['']*matches \\\n",
    "                  }, \\\n",
    "                  columns=['Date','Home','Away','FTHG','FTAG','1 goal','2 goal','3 goal',\\\n",
    "                          '4 goal','5 goal','6 goal','7 goal','8 goal','9 goal','10 goal','11 goal','12 goal'] \\\n",
    "                  )\n",
    "\n",
    "with open(path, 'r') as fl:\n",
    "    next(fl)\n",
    "    for row,match in enumerate(fl):\n",
    "        Date = match.split(',')[0]\n",
    "        Home = match.split(',')[1]\n",
    "        Away = match.split(',')[2]\n",
    "        # if match not kickoff, set -1\n",
    "        try:\n",
    "            FTHG = int(match.split(',')[3])\n",
    "            FTAG = int(match.split(',')[4])\n",
    "        except:\n",
    "            FTHG,FTAG = -1,-1\n",
    "        df.loc[row, ['Date','Home','Away','FTHG','FTAG']] = Date,Home,Away,FTHG,FTAG\n",
    "\n",
    "        # store goal times\n",
    "        pat = re.compile('\\(.+?\\)')\n",
    "        gos = [literal_eval(x.replace('\"\"', '\"')) for x in pat.findall(match)]\n",
    "        l = 12-len(gos);gos+=['']*l\n",
    "        #print gos\n",
    "        df.loc[row, ['1 goal','2 goal','3 goal','4 goal','5 goal','6 goal','7 goal','8 goal',\\\n",
    "                     '9 goal','10 goal','11 goal','12 goal']] = gos"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 479,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Date</th>\n",
       "      <th>Home</th>\n",
       "      <th>Away</th>\n",
       "      <th>FTHG</th>\n",
       "      <th>FTAG</th>\n",
       "      <th>1 goal</th>\n",
       "      <th>2 goal</th>\n",
       "      <th>3 goal</th>\n",
       "      <th>4 goal</th>\n",
       "      <th>5 goal</th>\n",
       "      <th>6 goal</th>\n",
       "      <th>7 goal</th>\n",
       "      <th>8 goal</th>\n",
       "      <th>9 goal</th>\n",
       "      <th>10 goal</th>\n",
       "      <th>11 goal</th>\n",
       "      <th>12 goal</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0  </th>\n",
       "      <td> 2009-08-15</td>\n",
       "      <td>             Aston Villa</td>\n",
       "      <td>          Wigan Athletic</td>\n",
       "      <td> 0</td>\n",
       "      <td> 2</td>\n",
       "      <td>        (31, 1, Hugo Rodallega)</td>\n",
       "      <td>          (56, 1, Jason Koumas)</td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1  </th>\n",
       "      <td> 2009-08-15</td>\n",
       "      <td>        Blackburn Rovers</td>\n",
       "      <td>         Manchester City</td>\n",
       "      <td> 0</td>\n",
       "      <td> 2</td>\n",
       "      <td>      (3, 1, Emmanuel Adebayor)</td>\n",
       "      <td>       (90, 1, Stephen Ireland)</td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2  </th>\n",
       "      <td> 2009-08-15</td>\n",
       "      <td>        Bolton Wanderers</td>\n",
       "      <td>              Sunderland</td>\n",
       "      <td> 0</td>\n",
       "      <td> 1</td>\n",
       "      <td>            (5, 1, Darren Bent)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3  </th>\n",
       "      <td> 2009-08-15</td>\n",
       "      <td>                 Chelsea</td>\n",
       "      <td>               Hull City</td>\n",
       "      <td> 2</td>\n",
       "      <td> 1</td>\n",
       "      <td>          (28, 1, Stephen Hunt)</td>\n",
       "      <td>         (37, 0, Didier Drogba)</td>\n",
       "      <td>      (90, 0, Didier Drogba)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4  </th>\n",
       "      <td> 2009-08-15</td>\n",
       "      <td>                 Everton</td>\n",
       "      <td>                 Arsenal</td>\n",
       "      <td> 1</td>\n",
       "      <td> 6</td>\n",
       "      <td>             (26, 1,  Denilson)</td>\n",
       "      <td>      (37, 1, Thomas Vermaelen)</td>\n",
       "      <td>     (41, 1, William Gallas)</td>\n",
       "      <td>       (48, 1, Cesc Fabregas)</td>\n",
       "      <td>    (69, 1, Cesc Fabregas)</td>\n",
       "      <td>         (88, 1,  Eduardo)</td>\n",
       "      <td>      (90, 0, Louis Saha)</td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5  </th>\n",
       "      <td> 2009-08-15</td>\n",
       "      <td>              Portsmouth</td>\n",
       "      <td>                  Fulham</td>\n",
       "      <td> 0</td>\n",
       "      <td> 1</td>\n",
       "      <td>          (13, 1, Bobby Zamora)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6  </th>\n",
       "      <td> 2009-08-15</td>\n",
       "      <td>              Stoke City</td>\n",
       "      <td>                 Burnley</td>\n",
       "      <td> 2</td>\n",
       "      <td> 0</td>\n",
       "      <td>        (19, 0, Ryan Shawcross)</td>\n",
       "      <td>        (33, 0, Stephen Jordan)</td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7  </th>\n",
       "      <td> 2009-08-15</td>\n",
       "      <td> Wolverhampton Wanderers</td>\n",
       "      <td>         West Ham United</td>\n",
       "      <td> 0</td>\n",
       "      <td> 2</td>\n",
       "      <td>            (22, 1, Mark Noble)</td>\n",
       "      <td>         (69, 1, Matthew Upson)</td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8  </th>\n",
       "      <td> 2009-08-16</td>\n",
       "      <td>       Manchester United</td>\n",
       "      <td>         Birmingham City</td>\n",
       "      <td> 1</td>\n",
       "      <td> 0</td>\n",
       "      <td>          (34, 0, Wayne Rooney)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9  </th>\n",
       "      <td> 2009-08-16</td>\n",
       "      <td>       Tottenham Hotspur</td>\n",
       "      <td>               Liverpool</td>\n",
       "      <td> 2</td>\n",
       "      <td> 1</td>\n",
       "      <td>   (44, 0, Benoit Assou-Ekotto)</td>\n",
       "      <td>        (56, 1, Steven Gerrard)</td>\n",
       "      <td>  (59, 0, Sebastien Bassong)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10 </th>\n",
       "      <td> 2009-08-18</td>\n",
       "      <td>              Sunderland</td>\n",
       "      <td>                 Chelsea</td>\n",
       "      <td> 1</td>\n",
       "      <td> 3</td>\n",
       "      <td>           (18, 0, Darren Bent)</td>\n",
       "      <td>       (52, 1, Michael Ballack)</td>\n",
       "      <td>      (61, 1, Frank Lampard)</td>\n",
       "      <td>               (70, 1,  Deco)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11 </th>\n",
       "      <td> 2009-08-18</td>\n",
       "      <td>          Wigan Athletic</td>\n",
       "      <td> Wolverhampton Wanderers</td>\n",
       "      <td> 0</td>\n",
       "      <td> 1</td>\n",
       "      <td>             (6, 1, Andy Keogh)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12 </th>\n",
       "      <td> 2009-08-19</td>\n",
       "      <td>         Birmingham City</td>\n",
       "      <td>              Portsmouth</td>\n",
       "      <td> 1</td>\n",
       "      <td> 0</td>\n",
       "      <td>        (90, 0, James McFadden)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13 </th>\n",
       "      <td> 2009-08-19</td>\n",
       "      <td>                 Burnley</td>\n",
       "      <td>       Manchester United</td>\n",
       "      <td> 1</td>\n",
       "      <td> 0</td>\n",
       "      <td>          (19, 0, Robbie Blake)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14 </th>\n",
       "      <td> 2009-08-19</td>\n",
       "      <td>               Hull City</td>\n",
       "      <td>       Tottenham Hotspur</td>\n",
       "      <td> 1</td>\n",
       "      <td> 5</td>\n",
       "      <td>         (10, 1, Jermain Defoe)</td>\n",
       "      <td>       (14, 1, Wilson Palacios)</td>\n",
       "      <td>       (25, 0, Stephen Hunt)</td>\n",
       "      <td>       (45, 1, Jermain Defoe)</td>\n",
       "      <td>     (78, 1, Robbie Keane)</td>\n",
       "      <td>    (90, 1, Jermain Defoe)</td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15 </th>\n",
       "      <td> 2009-08-19</td>\n",
       "      <td>               Liverpool</td>\n",
       "      <td>              Stoke City</td>\n",
       "      <td> 4</td>\n",
       "      <td> 0</td>\n",
       "      <td>        (4, 0, Fernando Torres)</td>\n",
       "      <td>          (45, 0, Glen Johnson)</td>\n",
       "      <td>          (78, 0, Dirk Kuyt)</td>\n",
       "      <td>         (90, 0, David N'Gog)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16 </th>\n",
       "      <td> 2009-08-22</td>\n",
       "      <td>                 Arsenal</td>\n",
       "      <td>              Portsmouth</td>\n",
       "      <td> 4</td>\n",
       "      <td> 1</td>\n",
       "      <td>            (18, 0, Abou Diaby)</td>\n",
       "      <td>            (21, 0, Abou Diaby)</td>\n",
       "      <td>     (51, 0, William Gallas)</td>\n",
       "      <td>        (68, 0, Aaron Ramsey)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17 </th>\n",
       "      <td> 2009-08-22</td>\n",
       "      <td>         Birmingham City</td>\n",
       "      <td>              Stoke City</td>\n",
       "      <td> 0</td>\n",
       "      <td> 0</td>\n",
       "      <td>                               </td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18 </th>\n",
       "      <td> 2009-08-22</td>\n",
       "      <td>               Hull City</td>\n",
       "      <td>        Bolton Wanderers</td>\n",
       "      <td> 1</td>\n",
       "      <td> 0</td>\n",
       "      <td>          (61, 0, Kamel Ghilas)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19 </th>\n",
       "      <td> 2009-08-22</td>\n",
       "      <td>         Manchester City</td>\n",
       "      <td> Wolverhampton Wanderers</td>\n",
       "      <td> 1</td>\n",
       "      <td> 0</td>\n",
       "      <td>     (17, 0, Emmanuel Adebayor)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20 </th>\n",
       "      <td> 2009-08-22</td>\n",
       "      <td>              Sunderland</td>\n",
       "      <td>        Blackburn Rovers</td>\n",
       "      <td> 2</td>\n",
       "      <td> 1</td>\n",
       "      <td>            (21, 1, Gael Givet)</td>\n",
       "      <td>         (32, 0, Kenwyne Jones)</td>\n",
       "      <td>      (53, 0, Kenwyne Jones)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21 </th>\n",
       "      <td> 2009-08-22</td>\n",
       "      <td>          Wigan Athletic</td>\n",
       "      <td>       Manchester United</td>\n",
       "      <td> 0</td>\n",
       "      <td> 5</td>\n",
       "      <td>          (56, 1, Wayne Rooney)</td>\n",
       "      <td>      (58, 1, Dimitar Berbatov)</td>\n",
       "      <td>       (65, 1, Wayne Rooney)</td>\n",
       "      <td>        (85, 1, Michael Owen)</td>\n",
       "      <td>            (90, 1,  Nani)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22 </th>\n",
       "      <td> 2009-08-23</td>\n",
       "      <td>                 Burnley</td>\n",
       "      <td>                 Everton</td>\n",
       "      <td> 1</td>\n",
       "      <td> 0</td>\n",
       "      <td>          (34, 0, Wade Elliott)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23 </th>\n",
       "      <td> 2009-08-23</td>\n",
       "      <td>                  Fulham</td>\n",
       "      <td>                 Chelsea</td>\n",
       "      <td> 0</td>\n",
       "      <td> 2</td>\n",
       "      <td>         (39, 1, Didier Drogba)</td>\n",
       "      <td>        (76, 1, Nicolas Anelka)</td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24 </th>\n",
       "      <td> 2009-08-23</td>\n",
       "      <td>         West Ham United</td>\n",
       "      <td>       Tottenham Hotspur</td>\n",
       "      <td> 1</td>\n",
       "      <td> 2</td>\n",
       "      <td>          (49, 0, Carlton Cole)</td>\n",
       "      <td>         (54, 1, Jermain Defoe)</td>\n",
       "      <td>       (79, 1, Aaron Lennon)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25 </th>\n",
       "      <td> 2009-08-24</td>\n",
       "      <td>               Liverpool</td>\n",
       "      <td>             Aston Villa</td>\n",
       "      <td> 1</td>\n",
       "      <td> 3</td>\n",
       "      <td>          (34, 1,  Lucas Leiva)</td>\n",
       "      <td>         (45, 1, Curtis Davies)</td>\n",
       "      <td>    (72, 0, Fernando Torres)</td>\n",
       "      <td>        (75, 1, Ashley Young)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26 </th>\n",
       "      <td> 2009-08-29</td>\n",
       "      <td>        Blackburn Rovers</td>\n",
       "      <td>         West Ham United</td>\n",
       "      <td> 0</td>\n",
       "      <td> 0</td>\n",
       "      <td>                               </td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27 </th>\n",
       "      <td> 2009-08-29</td>\n",
       "      <td>        Bolton Wanderers</td>\n",
       "      <td>               Liverpool</td>\n",
       "      <td> 2</td>\n",
       "      <td> 3</td>\n",
       "      <td>          (33, 0, Kevin Davies)</td>\n",
       "      <td>          (41, 1, Glen Johnson)</td>\n",
       "      <td>        (47, 0, Tamir Cohen)</td>\n",
       "      <td>     (56, 1, Fernando Torres)</td>\n",
       "      <td>   (83, 1, Steven Gerrard)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28 </th>\n",
       "      <td> 2009-08-29</td>\n",
       "      <td>                 Chelsea</td>\n",
       "      <td>                 Burnley</td>\n",
       "      <td> 3</td>\n",
       "      <td> 0</td>\n",
       "      <td>        (45, 0, Nicolas Anelka)</td>\n",
       "      <td>       (47, 0, Michael Ballack)</td>\n",
       "      <td>        (52, 0, Ashley Cole)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29 </th>\n",
       "      <td> 2009-08-29</td>\n",
       "      <td>       Manchester United</td>\n",
       "      <td>                 Arsenal</td>\n",
       "      <td> 2</td>\n",
       "      <td> 1</td>\n",
       "      <td>       (40, 1, Andrei Arshavin)</td>\n",
       "      <td>          (59, 0, Wayne Rooney)</td>\n",
       "      <td>         (64, 0, Abou Diaby)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>350</th>\n",
       "      <td> 2010-04-24</td>\n",
       "      <td>               Hull City</td>\n",
       "      <td>              Sunderland</td>\n",
       "      <td> 0</td>\n",
       "      <td> 1</td>\n",
       "      <td>            (7, 1, Darren Bent)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>351</th>\n",
       "      <td> 2010-04-24</td>\n",
       "      <td>       Manchester United</td>\n",
       "      <td>       Tottenham Hotspur</td>\n",
       "      <td> 3</td>\n",
       "      <td> 1</td>\n",
       "      <td>            (58, 0, Ryan Giggs)</td>\n",
       "      <td>           (70, 1, Ledley King)</td>\n",
       "      <td>              (81, 0,  Nani)</td>\n",
       "      <td>          (86, 0, Ryan Giggs)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>352</th>\n",
       "      <td> 2010-04-24</td>\n",
       "      <td>         West Ham United</td>\n",
       "      <td>          Wigan Athletic</td>\n",
       "      <td> 3</td>\n",
       "      <td> 2</td>\n",
       "      <td>       (4, 1, Jonathan Spector)</td>\n",
       "      <td>                 (31, 0,  Ilan)</td>\n",
       "      <td>     (45, 0, Radoslav Kovac)</td>\n",
       "      <td>      (52, 1, Hugo Rodallega)</td>\n",
       "      <td>     (77, 0, Scott Parker)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>353</th>\n",
       "      <td> 2010-04-24</td>\n",
       "      <td> Wolverhampton Wanderers</td>\n",
       "      <td>        Blackburn Rovers</td>\n",
       "      <td> 1</td>\n",
       "      <td> 1</td>\n",
       "      <td>           (28, 1, Ryan Nelsen)</td>\n",
       "      <td>   (81, 0, Sylvan Ebanks-Blake)</td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>354</th>\n",
       "      <td> 2010-04-25</td>\n",
       "      <td>             Aston Villa</td>\n",
       "      <td>         Birmingham City</td>\n",
       "      <td> 1</td>\n",
       "      <td> 0</td>\n",
       "      <td>          (83, 0, James Milner)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>355</th>\n",
       "      <td> 2010-04-25</td>\n",
       "      <td>                 Burnley</td>\n",
       "      <td>               Liverpool</td>\n",
       "      <td> 0</td>\n",
       "      <td> 4</td>\n",
       "      <td>        (52, 1, Steven Gerrard)</td>\n",
       "      <td>        (59, 1, Steven Gerrard)</td>\n",
       "      <td>     (74, 1, Maxi Rodriguez)</td>\n",
       "      <td>          (90, 1, Ryan Babel)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>356</th>\n",
       "      <td> 2010-04-25</td>\n",
       "      <td>                 Chelsea</td>\n",
       "      <td>              Stoke City</td>\n",
       "      <td> 7</td>\n",
       "      <td> 0</td>\n",
       "      <td>         (24, 0, Salomon Kalou)</td>\n",
       "      <td>         (31, 0, Salomon Kalou)</td>\n",
       "      <td>      (44, 0, Frank Lampard)</td>\n",
       "      <td>       (68, 0, Salomon Kalou)</td>\n",
       "      <td>    (81, 0, Frank Lampard)</td>\n",
       "      <td> (87, 0, Daniel Sturridge)</td>\n",
       "      <td> (89, 0, Florent Malouda)</td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>357</th>\n",
       "      <td> 2010-04-25</td>\n",
       "      <td>                 Everton</td>\n",
       "      <td>                  Fulham</td>\n",
       "      <td> 2</td>\n",
       "      <td> 1</td>\n",
       "      <td>          (36, 1, Erik Nevland)</td>\n",
       "      <td>        (49, 0, Chris Smalling)</td>\n",
       "      <td>       (90, 0, Mikel Arteta)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>358</th>\n",
       "      <td> 2010-05-01</td>\n",
       "      <td>         Birmingham City</td>\n",
       "      <td>                 Burnley</td>\n",
       "      <td> 2</td>\n",
       "      <td> 1</td>\n",
       "      <td>        (29, 0, Cameron Jerome)</td>\n",
       "      <td>     (41, 0, Christian Benitez)</td>\n",
       "      <td>    (87, 1, Steven Thompson)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>359</th>\n",
       "      <td> 2010-05-01</td>\n",
       "      <td>         Manchester City</td>\n",
       "      <td>             Aston Villa</td>\n",
       "      <td> 3</td>\n",
       "      <td> 1</td>\n",
       "      <td>            (16, 1, John Carew)</td>\n",
       "      <td>          (41, 0, Carlos Tevez)</td>\n",
       "      <td>  (43, 0, Emmanuel Adebayor)</td>\n",
       "      <td>       (89, 0, Craig Bellamy)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>360</th>\n",
       "      <td> 2010-05-01</td>\n",
       "      <td>              Portsmouth</td>\n",
       "      <td> Wolverhampton Wanderers</td>\n",
       "      <td> 3</td>\n",
       "      <td> 1</td>\n",
       "      <td>         (20, 0, Aruna Dindane)</td>\n",
       "      <td>           (35, 1, Kevin Doyle)</td>\n",
       "      <td>         (39, 0, John Utaka)</td>\n",
       "      <td>       (67, 0, Michael Brown)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>361</th>\n",
       "      <td> 2010-05-01</td>\n",
       "      <td>              Stoke City</td>\n",
       "      <td>                 Everton</td>\n",
       "      <td> 0</td>\n",
       "      <td> 0</td>\n",
       "      <td>                               </td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>362</th>\n",
       "      <td> 2010-05-01</td>\n",
       "      <td>       Tottenham Hotspur</td>\n",
       "      <td>        Bolton Wanderers</td>\n",
       "      <td> 1</td>\n",
       "      <td> 0</td>\n",
       "      <td>       (38, 0, Tom Huddlestone)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>363</th>\n",
       "      <td> 2010-05-02</td>\n",
       "      <td>                  Fulham</td>\n",
       "      <td>         West Ham United</td>\n",
       "      <td> 3</td>\n",
       "      <td> 2</td>\n",
       "      <td>         (45, 0, Clint Dempsey)</td>\n",
       "      <td>          (58, 0, Carlton Cole)</td>\n",
       "      <td>       (61, 1, Carlton Cole)</td>\n",
       "      <td> (79, 0, Stefano Okaka Chuka)</td>\n",
       "      <td> (90, 1, Guillermo Franco)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>364</th>\n",
       "      <td> 2010-05-02</td>\n",
       "      <td>               Liverpool</td>\n",
       "      <td>                 Chelsea</td>\n",
       "      <td> 0</td>\n",
       "      <td> 2</td>\n",
       "      <td>         (33, 1, Didier Drogba)</td>\n",
       "      <td>         (54, 1, Frank Lampard)</td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>365</th>\n",
       "      <td> 2010-05-02</td>\n",
       "      <td>              Sunderland</td>\n",
       "      <td>       Manchester United</td>\n",
       "      <td> 0</td>\n",
       "      <td> 1</td>\n",
       "      <td>                 (28, 1,  Nani)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>366</th>\n",
       "      <td> 2010-05-03</td>\n",
       "      <td>        Blackburn Rovers</td>\n",
       "      <td>                 Arsenal</td>\n",
       "      <td> 2</td>\n",
       "      <td> 1</td>\n",
       "      <td>      (13, 1, Robin Van Persie)</td>\n",
       "      <td>            (44, 0, David Dunn)</td>\n",
       "      <td>  (68, 0, Christopher Samba)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>367</th>\n",
       "      <td> 2010-05-03</td>\n",
       "      <td>          Wigan Athletic</td>\n",
       "      <td>               Hull City</td>\n",
       "      <td> 2</td>\n",
       "      <td> 2</td>\n",
       "      <td>          (30, 0, Victor Moses)</td>\n",
       "      <td>         (42, 1, Will Atkinson)</td>\n",
       "      <td>        (64, 1, Mark Cullen)</td>\n",
       "      <td>       (90, 0, Steve Gohouri)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>368</th>\n",
       "      <td> 2010-05-05</td>\n",
       "      <td>                  Fulham</td>\n",
       "      <td>              Stoke City</td>\n",
       "      <td> 0</td>\n",
       "      <td> 1</td>\n",
       "      <td>   (83, 1, Matthew Etherington)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>369</th>\n",
       "      <td> 2010-05-05</td>\n",
       "      <td>         Manchester City</td>\n",
       "      <td>       Tottenham Hotspur</td>\n",
       "      <td> 0</td>\n",
       "      <td> 1</td>\n",
       "      <td>          (82, 1, Peter Crouch)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>370</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td>                 Arsenal</td>\n",
       "      <td>                  Fulham</td>\n",
       "      <td> 4</td>\n",
       "      <td> 0</td>\n",
       "      <td>       (21, 0, Andrei Arshavin)</td>\n",
       "      <td>      (26, 0, Robin Van Persie)</td>\n",
       "      <td>        (37, 0, Chris Baird)</td>\n",
       "      <td>         (84, 0, Carlos Vela)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>371</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td>             Aston Villa</td>\n",
       "      <td>        Blackburn Rovers</td>\n",
       "      <td> 0</td>\n",
       "      <td> 1</td>\n",
       "      <td>         (84, 1, Richard Dunne)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>372</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td>        Bolton Wanderers</td>\n",
       "      <td>         Birmingham City</td>\n",
       "      <td> 2</td>\n",
       "      <td> 1</td>\n",
       "      <td>          (33, 0, Kevin Davies)</td>\n",
       "      <td>          (60, 0, Ivan Klasnic)</td>\n",
       "      <td>     (77, 1, James McFadden)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>373</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td>                 Burnley</td>\n",
       "      <td>       Tottenham Hotspur</td>\n",
       "      <td> 4</td>\n",
       "      <td> 2</td>\n",
       "      <td>            (3, 1, Gareth Bale)</td>\n",
       "      <td>           (32, 1, Luka Modric)</td>\n",
       "      <td>       (42, 0, Wade Elliott)</td>\n",
       "      <td>           (54, 0, Jack Cork)</td>\n",
       "      <td>  (71, 0, Martin Paterson)</td>\n",
       "      <td>  (88, 0, Steven Thompson)</td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>374</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td>                 Chelsea</td>\n",
       "      <td>          Wigan Athletic</td>\n",
       "      <td> 8</td>\n",
       "      <td> 0</td>\n",
       "      <td>         (6, 0, Nicolas Anelka)</td>\n",
       "      <td>         (32, 0, Frank Lampard)</td>\n",
       "      <td>      (54, 0, Salomon Kalou)</td>\n",
       "      <td>      (56, 0, Nicolas Anelka)</td>\n",
       "      <td>    (63, 0, Didier Drogba)</td>\n",
       "      <td>    (68, 0, Didier Drogba)</td>\n",
       "      <td>   (80, 0, Didier Drogba)</td>\n",
       "      <td> (90, 0, Ashley Cole)</td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>375</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td>                 Everton</td>\n",
       "      <td>              Portsmouth</td>\n",
       "      <td> 1</td>\n",
       "      <td> 0</td>\n",
       "      <td> (90, 0, Diniyar Bilyaletdinov)</td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>376</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td>               Hull City</td>\n",
       "      <td>               Liverpool</td>\n",
       "      <td> 0</td>\n",
       "      <td> 0</td>\n",
       "      <td>                               </td>\n",
       "      <td>                               </td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>377</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td>       Manchester United</td>\n",
       "      <td>              Stoke City</td>\n",
       "      <td> 4</td>\n",
       "      <td> 0</td>\n",
       "      <td>       (31, 0, Darren Fletcher)</td>\n",
       "      <td>            (38, 0, Ryan Giggs)</td>\n",
       "      <td> (54, 0, Danny Higginbotham)</td>\n",
       "      <td>        (84, 0, PARK Ji-Sung)</td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>378</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td>         West Ham United</td>\n",
       "      <td>         Manchester City</td>\n",
       "      <td> 1</td>\n",
       "      <td> 1</td>\n",
       "      <td>        (17, 0, Luis Boa Morte)</td>\n",
       "      <td> (21, 1, Shaun Wright-Phillips)</td>\n",
       "      <td>                            </td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>379</th>\n",
       "      <td> 2010-05-09</td>\n",
       "      <td> Wolverhampton Wanderers</td>\n",
       "      <td>              Sunderland</td>\n",
       "      <td> 2</td>\n",
       "      <td> 1</td>\n",
       "      <td>          (8, 1, Kenwyne Jones)</td>\n",
       "      <td>           (10, 0, Kevin Doyle)</td>\n",
       "      <td>   (78, 0, Adlene Guedioura)</td>\n",
       "      <td>                             </td>\n",
       "      <td>                          </td>\n",
       "      <td>                          </td>\n",
       "      <td>                         </td>\n",
       "      <td>                     </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "      <td> </td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>380 rows × 17 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           Date                     Home                     Away  FTHG  FTAG  \\\n",
       "0    2009-08-15              Aston Villa           Wigan Athletic     0     2   \n",
       "1    2009-08-15         Blackburn Rovers          Manchester City     0     2   \n",
       "2    2009-08-15         Bolton Wanderers               Sunderland     0     1   \n",
       "3    2009-08-15                  Chelsea                Hull City     2     1   \n",
       "4    2009-08-15                  Everton                  Arsenal     1     6   \n",
       "5    2009-08-15               Portsmouth                   Fulham     0     1   \n",
       "6    2009-08-15               Stoke City                  Burnley     2     0   \n",
       "7    2009-08-15  Wolverhampton Wanderers          West Ham United     0     2   \n",
       "8    2009-08-16        Manchester United          Birmingham City     1     0   \n",
       "9    2009-08-16        Tottenham Hotspur                Liverpool     2     1   \n",
       "10   2009-08-18               Sunderland                  Chelsea     1     3   \n",
       "11   2009-08-18           Wigan Athletic  Wolverhampton Wanderers     0     1   \n",
       "12   2009-08-19          Birmingham City               Portsmouth     1     0   \n",
       "13   2009-08-19                  Burnley        Manchester United     1     0   \n",
       "14   2009-08-19                Hull City        Tottenham Hotspur     1     5   \n",
       "15   2009-08-19                Liverpool               Stoke City     4     0   \n",
       "16   2009-08-22                  Arsenal               Portsmouth     4     1   \n",
       "17   2009-08-22          Birmingham City               Stoke City     0     0   \n",
       "18   2009-08-22                Hull City         Bolton Wanderers     1     0   \n",
       "19   2009-08-22          Manchester City  Wolverhampton Wanderers     1     0   \n",
       "20   2009-08-22               Sunderland         Blackburn Rovers     2     1   \n",
       "21   2009-08-22           Wigan Athletic        Manchester United     0     5   \n",
       "22   2009-08-23                  Burnley                  Everton     1     0   \n",
       "23   2009-08-23                   Fulham                  Chelsea     0     2   \n",
       "24   2009-08-23          West Ham United        Tottenham Hotspur     1     2   \n",
       "25   2009-08-24                Liverpool              Aston Villa     1     3   \n",
       "26   2009-08-29         Blackburn Rovers          West Ham United     0     0   \n",
       "27   2009-08-29         Bolton Wanderers                Liverpool     2     3   \n",
       "28   2009-08-29                  Chelsea                  Burnley     3     0   \n",
       "29   2009-08-29        Manchester United                  Arsenal     2     1   \n",
       "..          ...                      ...                      ...   ...   ...   \n",
       "350  2010-04-24                Hull City               Sunderland     0     1   \n",
       "351  2010-04-24        Manchester United        Tottenham Hotspur     3     1   \n",
       "352  2010-04-24          West Ham United           Wigan Athletic     3     2   \n",
       "353  2010-04-24  Wolverhampton Wanderers         Blackburn Rovers     1     1   \n",
       "354  2010-04-25              Aston Villa          Birmingham City     1     0   \n",
       "355  2010-04-25                  Burnley                Liverpool     0     4   \n",
       "356  2010-04-25                  Chelsea               Stoke City     7     0   \n",
       "357  2010-04-25                  Everton                   Fulham     2     1   \n",
       "358  2010-05-01          Birmingham City                  Burnley     2     1   \n",
       "359  2010-05-01          Manchester City              Aston Villa     3     1   \n",
       "360  2010-05-01               Portsmouth  Wolverhampton Wanderers     3     1   \n",
       "361  2010-05-01               Stoke City                  Everton     0     0   \n",
       "362  2010-05-01        Tottenham Hotspur         Bolton Wanderers     1     0   \n",
       "363  2010-05-02                   Fulham          West Ham United     3     2   \n",
       "364  2010-05-02                Liverpool                  Chelsea     0     2   \n",
       "365  2010-05-02               Sunderland        Manchester United     0     1   \n",
       "366  2010-05-03         Blackburn Rovers                  Arsenal     2     1   \n",
       "367  2010-05-03           Wigan Athletic                Hull City     2     2   \n",
       "368  2010-05-05                   Fulham               Stoke City     0     1   \n",
       "369  2010-05-05          Manchester City        Tottenham Hotspur     0     1   \n",
       "370  2010-05-09                  Arsenal                   Fulham     4     0   \n",
       "371  2010-05-09              Aston Villa         Blackburn Rovers     0     1   \n",
       "372  2010-05-09         Bolton Wanderers          Birmingham City     2     1   \n",
       "373  2010-05-09                  Burnley        Tottenham Hotspur     4     2   \n",
       "374  2010-05-09                  Chelsea           Wigan Athletic     8     0   \n",
       "375  2010-05-09                  Everton               Portsmouth     1     0   \n",
       "376  2010-05-09                Hull City                Liverpool     0     0   \n",
       "377  2010-05-09        Manchester United               Stoke City     4     0   \n",
       "378  2010-05-09          West Ham United          Manchester City     1     1   \n",
       "379  2010-05-09  Wolverhampton Wanderers               Sunderland     2     1   \n",
       "\n",
       "                             1 goal                          2 goal  \\\n",
       "0           (31, 1, Hugo Rodallega)           (56, 1, Jason Koumas)   \n",
       "1         (3, 1, Emmanuel Adebayor)        (90, 1, Stephen Ireland)   \n",
       "2               (5, 1, Darren Bent)                                   \n",
       "3             (28, 1, Stephen Hunt)          (37, 0, Didier Drogba)   \n",
       "4                (26, 1,  Denilson)       (37, 1, Thomas Vermaelen)   \n",
       "5             (13, 1, Bobby Zamora)                                   \n",
       "6           (19, 0, Ryan Shawcross)         (33, 0, Stephen Jordan)   \n",
       "7               (22, 1, Mark Noble)          (69, 1, Matthew Upson)   \n",
       "8             (34, 0, Wayne Rooney)                                   \n",
       "9      (44, 0, Benoit Assou-Ekotto)         (56, 1, Steven Gerrard)   \n",
       "10             (18, 0, Darren Bent)        (52, 1, Michael Ballack)   \n",
       "11               (6, 1, Andy Keogh)                                   \n",
       "12          (90, 0, James McFadden)                                   \n",
       "13            (19, 0, Robbie Blake)                                   \n",
       "14           (10, 1, Jermain Defoe)        (14, 1, Wilson Palacios)   \n",
       "15          (4, 0, Fernando Torres)           (45, 0, Glen Johnson)   \n",
       "16              (18, 0, Abou Diaby)             (21, 0, Abou Diaby)   \n",
       "17                                                                    \n",
       "18            (61, 0, Kamel Ghilas)                                   \n",
       "19       (17, 0, Emmanuel Adebayor)                                   \n",
       "20              (21, 1, Gael Givet)          (32, 0, Kenwyne Jones)   \n",
       "21            (56, 1, Wayne Rooney)       (58, 1, Dimitar Berbatov)   \n",
       "22            (34, 0, Wade Elliott)                                   \n",
       "23           (39, 1, Didier Drogba)         (76, 1, Nicolas Anelka)   \n",
       "24            (49, 0, Carlton Cole)          (54, 1, Jermain Defoe)   \n",
       "25            (34, 1,  Lucas Leiva)          (45, 1, Curtis Davies)   \n",
       "26                                                                    \n",
       "27            (33, 0, Kevin Davies)           (41, 1, Glen Johnson)   \n",
       "28          (45, 0, Nicolas Anelka)        (47, 0, Michael Ballack)   \n",
       "29         (40, 1, Andrei Arshavin)           (59, 0, Wayne Rooney)   \n",
       "..                              ...                             ...   \n",
       "350             (7, 1, Darren Bent)                                   \n",
       "351             (58, 0, Ryan Giggs)            (70, 1, Ledley King)   \n",
       "352        (4, 1, Jonathan Spector)                  (31, 0,  Ilan)   \n",
       "353            (28, 1, Ryan Nelsen)    (81, 0, Sylvan Ebanks-Blake)   \n",
       "354           (83, 0, James Milner)                                   \n",
       "355         (52, 1, Steven Gerrard)         (59, 1, Steven Gerrard)   \n",
       "356          (24, 0, Salomon Kalou)          (31, 0, Salomon Kalou)   \n",
       "357           (36, 1, Erik Nevland)         (49, 0, Chris Smalling)   \n",
       "358         (29, 0, Cameron Jerome)      (41, 0, Christian Benitez)   \n",
       "359             (16, 1, John Carew)           (41, 0, Carlos Tevez)   \n",
       "360          (20, 0, Aruna Dindane)            (35, 1, Kevin Doyle)   \n",
       "361                                                                   \n",
       "362        (38, 0, Tom Huddlestone)                                   \n",
       "363          (45, 0, Clint Dempsey)           (58, 0, Carlton Cole)   \n",
       "364          (33, 1, Didier Drogba)          (54, 1, Frank Lampard)   \n",
       "365                  (28, 1,  Nani)                                   \n",
       "366       (13, 1, Robin Van Persie)             (44, 0, David Dunn)   \n",
       "367           (30, 0, Victor Moses)          (42, 1, Will Atkinson)   \n",
       "368    (83, 1, Matthew Etherington)                                   \n",
       "369           (82, 1, Peter Crouch)                                   \n",
       "370        (21, 0, Andrei Arshavin)       (26, 0, Robin Van Persie)   \n",
       "371          (84, 1, Richard Dunne)                                   \n",
       "372           (33, 0, Kevin Davies)           (60, 0, Ivan Klasnic)   \n",
       "373             (3, 1, Gareth Bale)            (32, 1, Luka Modric)   \n",
       "374          (6, 0, Nicolas Anelka)          (32, 0, Frank Lampard)   \n",
       "375  (90, 0, Diniyar Bilyaletdinov)                                   \n",
       "376                                                                   \n",
       "377        (31, 0, Darren Fletcher)             (38, 0, Ryan Giggs)   \n",
       "378         (17, 0, Luis Boa Morte)  (21, 1, Shaun Wright-Phillips)   \n",
       "379           (8, 1, Kenwyne Jones)            (10, 0, Kevin Doyle)   \n",
       "\n",
       "                          3 goal                        4 goal  \\\n",
       "0                                                                \n",
       "1                                                                \n",
       "2                                                                \n",
       "3         (90, 0, Didier Drogba)                                 \n",
       "4        (41, 1, William Gallas)        (48, 1, Cesc Fabregas)   \n",
       "5                                                                \n",
       "6                                                                \n",
       "7                                                                \n",
       "8                                                                \n",
       "9     (59, 0, Sebastien Bassong)                                 \n",
       "10        (61, 1, Frank Lampard)                (70, 1,  Deco)   \n",
       "11                                                               \n",
       "12                                                               \n",
       "13                                                               \n",
       "14         (25, 0, Stephen Hunt)        (45, 1, Jermain Defoe)   \n",
       "15            (78, 0, Dirk Kuyt)          (90, 0, David N'Gog)   \n",
       "16       (51, 0, William Gallas)         (68, 0, Aaron Ramsey)   \n",
       "17                                                               \n",
       "18                                                               \n",
       "19                                                               \n",
       "20        (53, 0, Kenwyne Jones)                                 \n",
       "21         (65, 1, Wayne Rooney)         (85, 1, Michael Owen)   \n",
       "22                                                               \n",
       "23                                                               \n",
       "24         (79, 1, Aaron Lennon)                                 \n",
       "25      (72, 0, Fernando Torres)         (75, 1, Ashley Young)   \n",
       "26                                                               \n",
       "27          (47, 0, Tamir Cohen)      (56, 1, Fernando Torres)   \n",
       "28          (52, 0, Ashley Cole)                                 \n",
       "29           (64, 0, Abou Diaby)                                 \n",
       "..                           ...                           ...   \n",
       "350                                                              \n",
       "351               (81, 0,  Nani)           (86, 0, Ryan Giggs)   \n",
       "352      (45, 0, Radoslav Kovac)       (52, 1, Hugo Rodallega)   \n",
       "353                                                              \n",
       "354                                                              \n",
       "355      (74, 1, Maxi Rodriguez)           (90, 1, Ryan Babel)   \n",
       "356       (44, 0, Frank Lampard)        (68, 0, Salomon Kalou)   \n",
       "357        (90, 0, Mikel Arteta)                                 \n",
       "358     (87, 1, Steven Thompson)                                 \n",
       "359   (43, 0, Emmanuel Adebayor)        (89, 0, Craig Bellamy)   \n",
       "360          (39, 0, John Utaka)        (67, 0, Michael Brown)   \n",
       "361                                                              \n",
       "362                                                              \n",
       "363        (61, 1, Carlton Cole)  (79, 0, Stefano Okaka Chuka)   \n",
       "364                                                              \n",
       "365                                                              \n",
       "366   (68, 0, Christopher Samba)                                 \n",
       "367         (64, 1, Mark Cullen)        (90, 0, Steve Gohouri)   \n",
       "368                                                              \n",
       "369                                                              \n",
       "370         (37, 0, Chris Baird)          (84, 0, Carlos Vela)   \n",
       "371                                                              \n",
       "372      (77, 1, James McFadden)                                 \n",
       "373        (42, 0, Wade Elliott)            (54, 0, Jack Cork)   \n",
       "374       (54, 0, Salomon Kalou)       (56, 0, Nicolas Anelka)   \n",
       "375                                                              \n",
       "376                                                              \n",
       "377  (54, 0, Danny Higginbotham)         (84, 0, PARK Ji-Sung)   \n",
       "378                                                              \n",
       "379    (78, 0, Adlene Guedioura)                                 \n",
       "\n",
       "                        5 goal                     6 goal  \\\n",
       "0                                                           \n",
       "1                                                           \n",
       "2                                                           \n",
       "3                                                           \n",
       "4       (69, 1, Cesc Fabregas)          (88, 1,  Eduardo)   \n",
       "5                                                           \n",
       "6                                                           \n",
       "7                                                           \n",
       "8                                                           \n",
       "9                                                           \n",
       "10                                                          \n",
       "11                                                          \n",
       "12                                                          \n",
       "13                                                          \n",
       "14       (78, 1, Robbie Keane)     (90, 1, Jermain Defoe)   \n",
       "15                                                          \n",
       "16                                                          \n",
       "17                                                          \n",
       "18                                                          \n",
       "19                                                          \n",
       "20                                                          \n",
       "21              (90, 1,  Nani)                              \n",
       "22                                                          \n",
       "23                                                          \n",
       "24                                                          \n",
       "25                                                          \n",
       "26                                                          \n",
       "27     (83, 1, Steven Gerrard)                              \n",
       "28                                                          \n",
       "29                                                          \n",
       "..                         ...                        ...   \n",
       "350                                                         \n",
       "351                                                         \n",
       "352      (77, 0, Scott Parker)                              \n",
       "353                                                         \n",
       "354                                                         \n",
       "355                                                         \n",
       "356     (81, 0, Frank Lampard)  (87, 0, Daniel Sturridge)   \n",
       "357                                                         \n",
       "358                                                         \n",
       "359                                                         \n",
       "360                                                         \n",
       "361                                                         \n",
       "362                                                         \n",
       "363  (90, 1, Guillermo Franco)                              \n",
       "364                                                         \n",
       "365                                                         \n",
       "366                                                         \n",
       "367                                                         \n",
       "368                                                         \n",
       "369                                                         \n",
       "370                                                         \n",
       "371                                                         \n",
       "372                                                         \n",
       "373   (71, 0, Martin Paterson)   (88, 0, Steven Thompson)   \n",
       "374     (63, 0, Didier Drogba)     (68, 0, Didier Drogba)   \n",
       "375                                                         \n",
       "376                                                         \n",
       "377                                                         \n",
       "378                                                         \n",
       "379                                                         \n",
       "\n",
       "                       7 goal                8 goal 9 goal 10 goal 11 goal  \\\n",
       "0                                                                            \n",
       "1                                                                            \n",
       "2                                                                            \n",
       "3                                                                            \n",
       "4         (90, 0, Louis Saha)                                                \n",
       "5                                                                            \n",
       "6                                                                            \n",
       "7                                                                            \n",
       "8                                                                            \n",
       "9                                                                            \n",
       "10                                                                           \n",
       "11                                                                           \n",
       "12                                                                           \n",
       "13                                                                           \n",
       "14                                                                           \n",
       "15                                                                           \n",
       "16                                                                           \n",
       "17                                                                           \n",
       "18                                                                           \n",
       "19                                                                           \n",
       "20                                                                           \n",
       "21                                                                           \n",
       "22                                                                           \n",
       "23                                                                           \n",
       "24                                                                           \n",
       "25                                                                           \n",
       "26                                                                           \n",
       "27                                                                           \n",
       "28                                                                           \n",
       "29                                                                           \n",
       "..                        ...                   ...    ...     ...     ...   \n",
       "350                                                                          \n",
       "351                                                                          \n",
       "352                                                                          \n",
       "353                                                                          \n",
       "354                                                                          \n",
       "355                                                                          \n",
       "356  (89, 0, Florent Malouda)                                                \n",
       "357                                                                          \n",
       "358                                                                          \n",
       "359                                                                          \n",
       "360                                                                          \n",
       "361                                                                          \n",
       "362                                                                          \n",
       "363                                                                          \n",
       "364                                                                          \n",
       "365                                                                          \n",
       "366                                                                          \n",
       "367                                                                          \n",
       "368                                                                          \n",
       "369                                                                          \n",
       "370                                                                          \n",
       "371                                                                          \n",
       "372                                                                          \n",
       "373                                                                          \n",
       "374    (80, 0, Didier Drogba)  (90, 0, Ashley Cole)                          \n",
       "375                                                                          \n",
       "376                                                                          \n",
       "377                                                                          \n",
       "378                                                                          \n",
       "379                                                                          \n",
       "\n",
       "    12 goal  \n",
       "0            \n",
       "1            \n",
       "2            \n",
       "3            \n",
       "4            \n",
       "5            \n",
       "6            \n",
       "7            \n",
       "8            \n",
       "9            \n",
       "10           \n",
       "11           \n",
       "12           \n",
       "13           \n",
       "14           \n",
       "15           \n",
       "16           \n",
       "17           \n",
       "18           \n",
       "19           \n",
       "20           \n",
       "21           \n",
       "22           \n",
       "23           \n",
       "24           \n",
       "25           \n",
       "26           \n",
       "27           \n",
       "28           \n",
       "29           \n",
       "..      ...  \n",
       "350          \n",
       "351          \n",
       "352          \n",
       "353          \n",
       "354          \n",
       "355          \n",
       "356          \n",
       "357          \n",
       "358          \n",
       "359          \n",
       "360          \n",
       "361          \n",
       "362          \n",
       "363          \n",
       "364          \n",
       "365          \n",
       "366          \n",
       "367          \n",
       "368          \n",
       "369          \n",
       "370          \n",
       "371          \n",
       "372          \n",
       "373          \n",
       "374          \n",
       "375          \n",
       "376          \n",
       "377          \n",
       "378          \n",
       "379          \n",
       "\n",
       "[380 rows x 17 columns]"
      ]
     },
     "execution_count": 479,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# sort matches by date\n",
    "df.Date = [a.date() for a in pd.to_datetime(df.Date, dayfirst=True)]\n",
    "df.sort(columns=['Date', 'Home', 'Away'], inplace=True)\n",
    "df = df.reset_index(drop=True)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "df.to_csv('data/'+season+'.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 481,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "finish season: 1992-1993\n",
      "\n",
      "finish season: 1993-1994\n",
      "\n",
      "finish season: 1994-1995\n",
      "\n",
      "finish season: 1995-1996\n",
      "\n",
      "finish season: 1996-1997\n",
      "\n",
      "finish season: 1997-1998\n",
      "\n",
      "finish season: 1998-1999\n",
      "\n",
      "finish season: 1999-2000\n",
      "\n",
      "finish season: 2000-2001\n",
      "\n",
      "finish season: 2001-2002\n",
      "\n",
      "finish season: 2002-2003\n",
      "\n",
      "finish season: 2003-2004\n",
      "\n",
      "finish season: 2004-2005\n",
      "\n",
      "finish season: 2005-2006\n",
      "\n",
      "finish season: 2006-2007\n",
      "\n",
      "finish season: 2007-2008\n",
      "\n",
      "finish season: 2008-2009\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# I decided to change every file to this new format\n",
    "for season in ['1992-1993', '1993-1994', '1994-1995', '1995-1996', '1996-1997', '1997-1998', \\\n",
    "               '1998-1999', '1999-2000', '2000-2001', '2001-2002', '2002-2003', '2003-2004', \\\n",
    "               '2004-2005', '2005-2006', '2006-2007', '2007-2008', '2008-2009', '2009-2010', \\\n",
    "               '2010-2011', '2011-2012', '2012-2013', '2013-2014', '2014-2015', '2015-2016']:\n",
    "    path = 'data/'+season+'.csv'\n",
    "    with open(path, 'r') as fl:\n",
    "        content = fl.readlines()\n",
    "    goals = []\n",
    "    for i,match in enumerate(content):\n",
    "        if i == 0:\n",
    "            continue\n",
    "        try:\n",
    "            goals.append(int(match.split(',')[3]) + int(match.split(',')[4]))\n",
    "        except:\n",
    "            goals.append(0)\n",
    "    matches = len(content)-1\n",
    "    # for goal times, (6, 0, Olivier Giroud) represents Giroud scored a goal at the 6th minute of the match\n",
    "    # 0 represents the goal scored by home team, 1 represents the goal scored by away team\n",
    "    df = pd.DataFrame({'Date': ['']*matches, \\\n",
    "                       'Home': ['']*matches, \\\n",
    "                       'Away': ['']*matches, \\\n",
    "                       'FTHG': [0]*matches, \\\n",
    "                       'FTAG': [0]*matches, \\\n",
    "                       '1 goal': ['']*matches, '2 goal': ['']*matches, '3 goal': ['']*matches, \\\n",
    "                       '4 goal': ['']*matches, '5 goal': ['']*matches, '6 goal': ['']*matches, \\\n",
    "                       '7 goal': ['']*matches, \\\n",
    "                       '8 goal': ['']*matches, \\\n",
    "                       '9 goal': ['']*matches, \\\n",
    "                       '10 goal': ['']*matches, \\\n",
    "                       '11 goal': ['']*matches, \\\n",
    "                       '12 goal': ['']*matches \\\n",
    "                      }, \\\n",
    "                      columns=['Date','Home','Away','FTHG','FTAG','1 goal','2 goal','3 goal',\\\n",
    "                              '4 goal','5 goal','6 goal','7 goal','8 goal','9 goal','10 goal','11 goal','12 goal'] \\\n",
    "                      )\n",
    "\n",
    "    with open(path, 'r') as fl:\n",
    "        next(fl)\n",
    "        for row,match in enumerate(fl):\n",
    "            Date = match.split(',')[0]\n",
    "            Home = match.split(',')[1]\n",
    "            Away = match.split(',')[2]\n",
    "            # if match not kickoff, set -1\n",
    "            try:\n",
    "                FTHG = int(match.split(',')[3])\n",
    "                FTAG = int(match.split(',')[4])\n",
    "            except:\n",
    "                FTHG,FTAG = -1,-1\n",
    "            df.loc[row, ['Date','Home','Away','FTHG','FTAG']] = Date,Home,Away,FTHG,FTAG\n",
    "\n",
    "            # store goal times\n",
    "            pat = re.compile('\\(.+?\\)')\n",
    "            gos = [literal_eval(x.replace('\"\"', '\"')) for x in pat.findall(match)]\n",
    "            l = 12-len(gos);gos+=['']*l\n",
    "            #print gos\n",
    "            df.loc[row, ['1 goal','2 goal','3 goal','4 goal','5 goal','6 goal','7 goal','8 goal',\\\n",
    "                         '9 goal','10 goal','11 goal','12 goal']] = gos\n",
    "    # sort matches by date\n",
    "    df.Date = [a.date() for a in pd.to_datetime(df.Date, dayfirst=True)]\n",
    "    df.sort(columns=['Date', 'Home', 'Away'], inplace=True)\n",
    "    df = df.reset_index(drop=True)\n",
    "    df.to_csv('data/'+season+'.csv', index=False)\n",
    "    print 'finish season: '+season+'\\n'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "Above this line\n",
    "\n",
    "==================================================================================================================="
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Premier League table  after close of play on 01 September 1992\n",
      "Premier League table  after close of play on 01 September 1993\n",
      "Premier League table  after close of play on 01 September 1994\n",
      "Premier League table  after close of play on 01 September 1995\n",
      "Premier League table  after close of play on 01 September 1996\n",
      "Premier League table  after close of play on 01 September 1997\n",
      "Premier League table  after close of play on 01 September 1998\n",
      "Premier League table  after close of play on 01 September 1999\n",
      "Premier League table  after close of play on 01 September 2000\n",
      "Premier League table  after close of play on 01 September 2001\n",
      "Premier League table  after close of play on 01 September 2002\n",
      "Premier League table  after close of play on 01 September 2003\n",
      "Premier League table  after close of play on 01 September 2004\n",
      "Premier League table  after close of play on 01 September 2005\n",
      "Premier League table  after close of play on 01 September 2006\n",
      "Premier League table  after close of play on 01 September 2007\n",
      "Premier League table  after close of play on 01 September 2008\n",
      "Premier League table  after close of play on 01 September 2009\n",
      "Premier League table  after close of play on 01 September 2010\n",
      "Premier League table  after close of play on 01 September 2011\n",
      "Premier League table  after close of play on 01 September 2012\n",
      "Premier League table  after close of play on 01 September 2013\n",
      "Premier League table  after close of play on 01 September 2014\n",
      "Premier League table  after close of play on 01 September 2015\n"
     ]
    }
   ],
   "source": [
    "urls = url_by_season # a list of urls\n",
    "\n",
    "# A simple task to do to each response object\n",
    "def do_something(response):\n",
    "    return g(response).by_class('column columns1')[0].by_tag('h2')[0].content.strip()\n",
    "\n",
    "rs = (grequests.get(u) for u in urls)\n",
    "responses = grequests.map(rs)\n",
    "\n",
    "for response in responses:\n",
    "    print do_something(response)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "==============="
     ]
    }
   ],
   "source": [
    "import time\n",
    "import sys\n",
    "\n",
    "for i in range(15):\n",
    "    time.sleep(0.1)\n",
    "    sys.stdout.write(\"=\")\n",
    "    sys.stdout.flush()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2 sec"
     ]
    }
   ],
   "source": [
    "# define function to count runtime of program\n",
    "def progress():\n",
    "    for i in range(30):\n",
    "        time.sleep(0.1)\n",
    "        sys.stdout.write(\"\\r%d sec\" % (i/10) )\n",
    "        sys.stdout.flush()\n",
    "progress()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
